import org.newdawn.slick.GameContainer;

import net.phys2d.math.ROVector2f;
import net.phys2d.raw.Body;


public class EntityPlayer extends Entity {
	
	public EntityPlayer(float x, float y, float width, float height, float weight) {
		super(x, y, width, height, weight);
		onplatform = false;
		playerlooped = false;
		jumps = 0;
		maxjumps = 2;
		this.removeoffscreen = false;
	}
	
	public void loopPlayer(GameContainer gc, boolean gravityflipped) {
		ROVector2f pos = body.getPosition();
		if (pos.getX() > gc.getWidth()) {
			setPosition(0.0f, pos.getY(), false);
		}
		else if (pos.getX() < 0) {
			setPosition(gc.getWidth(), pos.getY(), false);
		}
		else if (pos.getY() > gc.getHeight()) {
			setPosition(pos.getX(), 0, false);
			playerlooped = !gravityflipped;
		}
		else if (pos.getY() < 0) {
//			setPosition(pos.getX(), gc.getHeight(), false);
			playerlooped = gravityflipped;
		}
	}
	
	public void setOnPlatform(boolean bool) {
		onplatform = bool;
	}
	
	public boolean isOnPlatform() {
		return onplatform;
	}
	public boolean canJump() {
		return onplatform || jumps < maxjumps;
	}
	
	public void jump() {
		onplatform = false;
		jumps++;
	}
	
	
	public boolean onplatform;
	public boolean playerlooped;
	public int jumps;
	public int maxjumps;
	public float jumpheight;
	public float basejump;
	

}
